﻿using System;
using System.Collections.Generic;
using System.Text;
using WsProtocol.IEC62056.DataTypeClass;

namespace WsProtocol.IEC62056.CosemACSE
{
    public class ACSE_DataNotification //DataNotification
    {
        //long-invoke-id-and-priority Long-Invoke-Id-And-Priority,Unsigned32
        //date-time OCTET STRING,
        //notification-body   Data
        public static int Response(ref string frameData, CosemObject OI, ref string errorinfo)
        {
            int iResult = 0;
            try
            {
                if (string.IsNullOrEmpty(frameData)) return -1;

                //加入Push中间多余的字节的解析
                frameData = frameData.Remove(0,34);
                //去掉多余字节后的帧数据解析
                if (OI == null)
                    OI = new CosemObject();
                if (OI.DataNode == null)
                {
                    OI.AddNode(new ElementData());  //创建一个新数据节点  
                }
                iResult = Data.AnalizeData(ref frameData, OI.DataNode, ref errorinfo);
            }
            catch (Exception ex)
            {
                errorinfo = ex.ToString();
            }
            return iResult;
        }
    }

    //current-time GeneralizedTime OPTIONAL,
    //variable-access-specification SEQUENCE OF Variable-Access-Specification,
    //list-of-data SEQUENCE OF Data
    public class ReportRequest { }
}
